const path = require("path");
const {fileUploadError} = require('../constant/err.type')
class commonController {
    async upload(ctx, next) {
        const file = ctx.request.files
        if (file) {
            ctx.body = {
                code: 0,
                message: '上传成功',
                result: {
                    img: path.basename(file.avatar.filepath)
                }
            }
        } else {
            return ctx.app.emit('error', fileUploadError, ctx)
        }
    }
}
module.exports = new commonController()
